<?php

namespace app\qingadmin\controller;

use think\facade\Db;
use think\facade\Request;

class Fapiao extends Base
{
    public function index(){
        $fapiaoData=Db::name('fapiao')->order('id desc')->paginate(10);
        return view('',[
            'fapiaoData'=>$fapiaoData
        ]);
    }
    
    public function edit(){
        $id=Request::instance()->param('id');
        $fapiaoData=Db::name('fapiao')->find($id);
        return view('',[
            'fapiaoData'=>$fapiaoData
        ]);
    }
    //发票删除
    public function del(){
        $id=input('id');
        $dbname=input('dbname');
        $res=Db::name($dbname)->delete($id);
        if($res){
            return alert('操作成功',$_SERVER['HTTP_REFERER'],6);
        }else{
            return alert('操作失败',$_SERVER['HTTP_REFERER'],6);
        }   
    }
    
}